/*
 *
 *  * Copyright 2019-2020 the original author or authors.
 *  *
 *  * Licensed under the Apache License, Version 2.0 (the "License");
 *  * you may not use this file except in compliance with the License.
 *  * You may obtain a copy of the License at
 *  *
 *  *      https://www.apache.org/licenses/LICENSE-2.0
 *  *
 *  * Unless required by applicable law or agreed to in writing, software
 *  * distributed under the License is distributed on an "AS IS" BASIS,
 *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  * See the License for the specific language governing permissions and
 *  * limitations under the License.
 *
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.0.0).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
package org.wapache.openapi.spring.webmvc.demo.api;

import java.util.Map;

import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

import org.wapache.openapi.spring.webmvc.demo.model.Order;
import org.wapache.openapi.v3.annotations.Operation;
import org.wapache.openapi.v3.annotations.Parameter;
import org.wapache.openapi.v3.annotations.media.Content;
import org.wapache.openapi.v3.annotations.media.Schema;
import org.wapache.openapi.v3.annotations.parameters.ApiRequestBody;
import org.wapache.openapi.v3.annotations.responses.ApiResponse;
import org.wapache.openapi.v3.annotations.responses.ApiResponses;
import org.wapache.openapi.v3.annotations.security.SecurityRequirement;
import org.wapache.openapi.v3.annotations.tags.Tag;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@javax.annotation.Generated(value = "org.springdoc.demo.app2.codegen.languages.SpringCodegen", date = "2019-07-11T00:09:29.839+02:00[Europe/Paris]")

@Tag(name = "store", description = "商店接口")
public interface StoreApi {

	default StoreApiDelegate getDelegate() {
		return new StoreApiDelegate() {
		};
	}

	@Operation(
		summary = "根据订单ID删除订单",
		description = "本Demo程序将0到1000以内的ID当成有效的订单ID, 其他范围的ID都会返回错误",
		tags = { "store" }
	)
	@ApiResponses(value = {
		@ApiResponse(responseCode = "400", description = "订单ID不合法"),
		@ApiResponse(responseCode = "404", description = "订单不存在") 
	})
	@DeleteMapping(value = "/store/order/{orderId}")
	default ResponseEntity<Void> deleteOrder(
			@Parameter(description = "订单ID", required = true, schema = @Schema(type = "integer", format = "int64")) @PathVariable("orderId") Long orderId) {
		return getDelegate().deleteOrder(orderId);
	}

	@Operation(
		summary = "获取库存信息(按状态分组)",
		description = "返回状态和对应的数量",
		security = {
			@SecurityRequirement(name = "api_key")
		},
		tags = { "store" }
	)
	@ApiResponses(value = {
		@ApiResponse(responseCode = "200", description = "操作成功", content = @Content(schema = @Schema(type = "object")))
	})
	@GetMapping(value = "/store/inventory", produces = { "application/json" })
	default ResponseEntity<Map<String, Integer>> getInventory() {
		return getDelegate().getInventory();
	}

	@Operation(
		summary = "根据订单ID获取订单信息",
		description = "本Demo程序将小于5或者大于10的ID当成有效的订单ID, 其他范围的ID都会返回错误",
		tags = { "store" }
	)
	@ApiResponses(value = {
		@ApiResponse(responseCode = "200", description = "操作成功", content = @Content(schema = @Schema(implementation = Order.class))),
		@ApiResponse(responseCode = "400", description = "订单ID不合法", content = @Content),
		@ApiResponse(responseCode = "404", description = "订单不存在", content = @Content)
	})
	@GetMapping(value = "/store/order/{orderId}", produces = { "application/json", "application/xml" })
	default ResponseEntity<Order> getOrderById(
			@Min(1L) @Max(5L) @Parameter(description = "订单ID", required = true) @PathVariable("orderId") Long orderId) {
		return getDelegate().getOrderById(orderId);
	}

	@Operation(summary = "提交订单", description = "下订单", tags = { "store" })
	@ApiResponses(value = {
		@ApiResponse(responseCode = "200", description = "操作成功", content = @Content(schema = @Schema(implementation = Order.class))),
		@ApiResponse(responseCode = "405", description = "非法的输入", content = @Content)
	})
	@PostMapping(value = "/store/order", produces = { "application/json" }, consumes = { "application/json", "application/xml", "application/x-www-form-urlencoded" })
	default ResponseEntity<Order> placeOrder(
			@ApiRequestBody(description = "") @Valid @RequestBody Order order) {
		return getDelegate().placeOrder(order);
	}

}
